#include("../../comm/ListHead.html")
<div id="main" style="width:100%;margin: 10px;">
    <div style="text-align:center">
        <form class="layui-form">
            <div class="layui-form-item">
                <input type="hidden" id="user_user" value='#(select_user)'>
                <input type="hidden" id="user_data" value='#(all_user)'>
                <input type="hidden" id="act_id" value='#(act.act_id)'>

                <div id="trans_div" style="width:500px;margin:0 auto;text-align:left"></div>
            </div>
            <div class="layui-form-item">
                <div class="layui-btn-container2" style="margin:10px;text-align:center">
                    <button type="button" class="layui-btn" lay-active="getData">保存</button>
                    <button type="button" class="layui-btn" lay-active="reload">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<SCRIPT LANGUAGE="JavaScript">
    <!--
    var $ = layui.$;
    var user_user = JSON.parse($("#user_user").val());
    var user_data = JSON.parse($("#user_data").val());
    var act_id = layui.$("#act_id").val();

    layui.use(['transfer', 'layer', 'util'], function () {
        var transfer = layui.transfer;
        var layer = layui.layer;
        //渲染
        transfer.render({
            elem: '#trans_div'  //绑定元素
            , data: user_data
            , id: 'trans_1' //定义索引
            , title: ['未选人员', '已选人员'] //定义索引
            , text: {
                none: '未选择任何人员' //没有数据时的文案
                , searchNone: '无匹配人员' //搜索无匹配数据时的文案
            }
            , value: user_user
            , showSearch: false
            , width: 200
            , height: 320
        });


        layui.util.event("lay-active", {
            getData: function () {
                var relestr = transfer.getData('trans_1'); //获取右侧数据
                var index = layer.load(1);
                layui.$.ajax({
                    type: 'POST',
                    url: "SetActivityUserApi",
                    data: {act_id: act_id, user_str: JSON.stringify(relestr)},
                    success: function (results) {
                        if (results.code == 0) {
                            layer.alert(results.msg, {offset: '100px'}, function (index) {
                                top.layer.closeAll();
                            });
                        } else {
                            layer.close(index);
                            layer.msg(results.msg);
                        }
                        return false;
                    },
                    error: function (return_data) {
                        return false;
                    },
                    dataType: "json"
                });
            }
            , reload: function () {
                transfer.reload('trans_1', {
                    value: user_user
                })
            }
        });
    });
    //-->
</SCRIPT>
</body>
</html>